#ifndef UDATETIMEEDIT_H
#define UDATETIMEEDIT_H

#include "utkwidget_export.h"

#include <QDateTimeEdit>

class UDateTimeEditPrivate;
class UTKWIDGET_EXPORT UDateTimeEdit : public QDateTimeEdit
{
    Q_OBJECT
public:
    explicit UDateTimeEdit(QWidget* parent = nullptr);

    UDateTimeEdit(const QVariant &val, QMetaType::Type parserType, QWidget* parent = nullptr);

    ~UDateTimeEdit();

    void setBorderWidth(double width);

    void setRadius(int radius);

    void setRightIconVisible(bool isVisible);

private slots:
    void onSyncDateTimeEditDate(const QDateTime &time);

protected:
    void paintEvent(QPaintEvent* event) override;

    void mousePressEvent(QMouseEvent* event) override;

    bool eventFilter(QObject* watched, QEvent* event) override;

private:
    QScopedPointer<UDateTimeEditPrivate> d_ptr;
    Q_DISABLE_COPY(UDateTimeEdit)
    Q_DECLARE_PRIVATE_D(d_ptr, UDateTimeEdit)
};

class UTKWIDGET_EXPORT UDateEdit : public UDateTimeEdit
{
    Q_OBJECT
public:
    explicit UDateEdit(QWidget* parent = nullptr);
    explicit UDateEdit(const QDate &date, QWidget* parent = nullptr);
    ~UDateEdit();
};

class UTKWIDGET_EXPORT UTimeEdit : public UDateTimeEdit
{
    Q_OBJECT
public:
    explicit UTimeEdit(QWidget* parent = nullptr);
    explicit UTimeEdit(const QTime &time, QWidget* parent = nullptr);
    ~UTimeEdit();
};

#endif // UDATETIMEEDIT_H
